<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>LingPowerAI</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script type="text/javascript">
			document.write('<script src="../../js/fix.js?rd=?rd=' + Math.random() + '"><\/script>');
		</script>
		<script type="text/javascript">
			link(['../../css/reset.css','../../css/picker/mui.picker.min.css']);
		</script>
		<style type="text/css">
			.pick_photo{width: 0.3rem;height: 0.3rem;float:right;vertical-align: middle;}
			.display-inline{display: inline-block;}
			.card-dash{width:100%; background-color: #FFFFFF;margin-top: 0.1rem; padding: 0.1rem 0;}
			.i_blue{color:#47BAFE}
			.left-border3{border-left: 0.03rem solid #47BAFE;}
			.float-m9{margin: 0 auto; width:90%;}
			.clear2{margin: 0.02rem 0;}
			.clear5{margin: 0.05rem 0;}
			.clear10{margin: 0.05rem 0;}
			label,i {color: #5A5A5A; font-size: 0.12rem;}
			.male_div label {padding:0 0.1rem;}
			ul{padding-left: 0;margin: 0 auto;}
			li{ width:90%;padding:0.05rem !important;margin: 0 auto;}
			.checked{background-color:#47BAFE !important;}
			.uncheck{background-color:rgb(167,182,189)}
			.circle{border-radius: 50%;color:#fff; width:0.25rem;height:0.25rem;line-height:0.25rem;text-align:center; font-size: 0.12rem;display: inline-block;}
			.label_lineh{line-height: 0.35rem; vertical-align: middle;}
			#save{background: #0075bb;padding:0.05rem 0.1rem;}
			#save:active{background: #999;}
				.mui-pciker-list li.highlight {
		    color: #47BAFE;
		}
		.mui-dtpicker, .mui-poppicker{
			background: #fff;
		}
		.mui-picker{
			background: #fff;
		}
		.mui-pciker-rule-ft{
			border: none;
		}
		.mui-btn-blue, .mui-btn-primary, input[type=submit]{
			background: #47BAFE;
			border: none;
		}
		.mui-dtpicker-title h5{
			background: #fff;
			border-color:#EEEEEE ;
		}
				.mui-popup-button:first-child{
			color: #47BAFE;
		}
		.mui-popup-button-bold{
			color: #47BAFE !important;
		}
		</style>
	</head>
	<body style="display: none;opacity: 0;">
<!-- 		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-back mui-pull-left" id="btn_back"></a>
			<h1 class="mui-title" id="title_name"></h1>
			<button type="button" class="head-button" id="save">保存</button>
		</header> -->
		<div class="mui-content "  style="padding-bottom: 0.1rem;">
			<div  id="baseInfo_div">
				<script type="text/html" id="baseInfo">
				<ul class="mui-table-view  tblv-nl mt15 "> 
					<li class="mui-table-view-cell  ">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">头像</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							{{if model.wechat_img != '' && model.wechat_img!=null && model.wechat_img!="null" }}
							<img class="pick_photo" id='wechat_img' data-preview-group="1" data-url="{{model.wechat_img}}" />
							{{else}}
							<img class="pick_photo" data-preview-group="1" src="{{model.sex=="F"?"../../images/mrtxF.jpg":"../../images/mrtxM.jpg"}}" />
							{{/if}}
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">手机</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="phone_no" value="{{model.phone_no}}" placeholder="请输手机号" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14 phone" type="text" />
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">姓名</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="phone_nm" value="{{model.src!="0"?(model.wechat_memo==""||model.wechat_memo==null?model.wechat_nm:model.wechat_memo):model.phone_nm}}" placeholder="请输入姓名" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">微信号</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="wechat_no" value="{{model.wechat_no}}" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
				
				</ul>
				<ul class="mui-table-view  tblv-nl mt15">
					<li class="mui-table-view-cell mui-collapse-content">
					<div style="margin-left:-0.05rem;"><label class="left-border3" style="padding-left:0.05rem;">个人信息</label></div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">性别</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div class="male_div" style="display: inline-block;">
								<i id="sex_M" class="check_sex mui-icon fa fa-male"> 男</i>
								<i id="sex_F" style="margin-left: 0.05rem;" class="check_sex mui-icon fa fa-female"> 女</i>
							</div>
							<input id="sex" type="hidden" value="{{model.sex}}"/>
						</div>
					</li>
					
					<li class="mui-table-view-cell ">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">出生年月</label>
						<div id='birth_date' data-options='{"type":"date"}' class="dis-b h30 label_lineh">{{model.birth_date}}</div>
					</li>
					<li class="mui-table-view-cell ">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">所在城市</label>
						<a id='region' class="mui-col-xs-9 mui-pull-left label_lineh" style="margin-left: -0.05rem;margin-top: -0.05rem; height:0.45rem;">
							{{if model.zipcode != "" & model.zipcode != null}}{{else}}
								<span class="cor-999">请选择</span>
								
								{{/if}}
						</a>
					</li>
					<li class="mui-table-view-cell mui-collapse-content" style="height: 0.82rem; background-color: #fff;">
						<label class="mui-col-xs-3 p0 h30 mui-pull-left">详细地址</label>
						<textarea rows="3" id="address" style="width: 75%;" class="mui-input-clear mb0 bor-no p0 lh30 fs14">{{model.address}}</textarea>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">婚姻状体</label>
						<div class="marriage_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='marriage_0' class="check_marriage uncheck circle" style="width:0.5rem;border-radius: 25px;">未婚</div>
							<div id='marriage_1' class="check_marriage uncheck circle" style="width:0.5rem;border-radius: 25px;">已婚</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">有子女</label>
						<div class="child_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='child_0' class="check_child uncheck circle">无</div>
							<div id='child_1' class="check_child uncheck circle" style="width:0.6rem;border-radius: 25px;">一个子女</div>
							<div id='child_2' class="check_child uncheck circle" style="width:0.6rem;border-radius: 25px;">两个子女</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">有父母</label>
						<div class="parent_div mui-input-row mui-col-xs-9 dis-ib label_lineh">
							<div id='parent_0' class="check_parent uncheck circle" style="width:0.5rem;border-radius: 25px;">父母都在</div>
							<div id='parent_1' class="check_parent uncheck circle" style="width:0.5rem;border-radius: 25px;">父亲在</div>
							<div id='parent_2' class="check_parent uncheck circle" style="width:0.5rem;border-radius: 25px;">母亲在</div>
							<div id='parent_3' class="check_parent uncheck circle" style="width:0.6rem;border-radius: 25px;">父母不在</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">职业性质</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="industry" value="{{model.industry}}" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">微博</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="weibo" value="{{model.weibo_id}}" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">Linkedin</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="linkedin_id" name="linkedin_id" value="{{model.linkedin_id}}" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
				</ul>
				
				<ul class="mui-table-view  tblv-nl mt15">
					<li class="mui-table-view-cell mui-collapse-content">
					<div style="margin-left:-0.05rem;"><label class="left-border3" style="padding-left:0.05rem;">资产状况</label></div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">年度收入</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="yearly_income" name="yearly_income" value="{{model.yearly_income}}" placeholder="请输入年度收入" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left">年度支出</label>
						<div class="mui-input-row mui-col-xs-9 dis-ib" style="width: 75%;">
							<input id="yearly_expense" name="yearly_expense" value="{{model.yearly_expense}}" placeholder="请输入年度支出" class="mui-input-clear mb0 bor-no p0 h30 lh30 fs14" type="text" />
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">固定资产</label>
						<div class="gdzc_div mui-input-row mui-col-xs-9 dis-ib label_lineh" >
							<div id='gdzc_house' class="check_gdzc uncheck circle" style="width:0.5rem;border-radius: 25px;">有房</div>
							<div id='gdzc_house_loan' class="check_gdzc uncheck circle" style="width:0.5rem;border-radius: 25px;">房贷</div>
							<div id='gdzc_car' class="check_gdzc uncheck circle" style="width:0.5rem;border-radius: 25px;">有车</div>
							<div id='gdzc_car_loan' class="check_gdzc uncheck circle" style="width:0.5rem;border-radius: 25px;">车贷</div>
						</div>
					</li>
				</ul>
				<ul class="mui-table-view  tblv-nl mt15">
					<li class="mui-table-view-cell mui-collapse-content">
					<div style="margin-left:-0.05rem;"><label class="left-border3" style="padding-left:0.05rem;">健康状况</label></div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">每年体检</label>
						<div class="health_check_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='health_check_0' class="check_health_check uncheck circle" >无</div>
							<div id='health_check_1' class="check_health_check uncheck circle" >是</div>
							<div id='health_check_2' class="check_health_check uncheck circle" style="width:0.5rem;border-radius: 25px;">偶尔</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">是否吸烟</label>
						<div class="smoke_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='smoke_0' class="check_smoke uncheck circle" >无</div>
							<div id='smoke_2' class="check_smoke uncheck circle" >是</div>
							<div id='smoke_1' class="check_smoke uncheck circle" style="width:0.5rem;border-radius: 25px;">偶尔</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">是否饮酒</label>
						<div class="alcohol_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='alcohol_0' class="check_alcohol uncheck circle" >无</div>
							<div id='alcohol_2' class="check_alcohol uncheck circle" >是</div>
							<div id='alcohol_1' class="check_alcohol uncheck circle" style="width:0.5rem;border-radius: 25px;">偶尔</div>
						</div>
					</li>
					<li class="mui-table-view-cell mui-collapse-content">
						<label class="mui-col-xs-3 mui-pull-left label_lineh">既往病史</label>
						<div class="sick_div mui-input-row mui-col-xs-9 dis-ib label_lineh" style="width: 75%;">
							<div id='sick_0' class="check_sick uncheck circle" >无</div>
							<div id='sick_1' class="check_sick uncheck circle" style="width:0.6rem;border-radius: 25px;">无大病史</div>
							<div id='sick_2' class="check_sick uncheck circle" style="width:0.6rem;border-radius: 25px;">有大病史</div>
						</div>
					</li>
				</ul>
				</script>
			</div>
			<div id='regionbox' class="ui-alert"></div>
		</div>
		<script type="text/javascript">
			script(['../../libs/picker/mui.dtpicker.js', '../../libs/region.js']);
		</script>
		<script type="text/javascript">
			var backid = "index.html";
			var backurl = "../" + backid;
			var custId;
			var postData = {};
			var postData2 = {};
			
			mui.init();
			mui.plusReady(function() {
			//mui.ready(function() {
				var regionPicker;
				
				storage.init();
					storageUser = kidstorageuser.getInstance();
				var self = plus.webview.currentWebview();
				self.setStyle({
					scrollIndicator:"none"
				})
				custId = self.custId;
				backid = self.backid;
				backurl = "../" + backid;
				//custId = "E63CA7ADF0F547118841350E05DA1B01";
				getData(custId);
            
			
				
			});
	
		//保存
	function saveFrom(){
		plus.nativeUI.showWaiting("请稍等...");
			//alert(JSON.stringify(postData));
		// if(!postData || !postData.sex || postData.sex == "") {
		// 	appUI.showTopTip("性别不能为空");
		// 	return;
		// }
		// if(!postData || !postData.birth_date || postData.birth_date == "") {
		// 	appUI.showTopTip("生日不能为空");
		// 	return;
		// }
		// 
		// if(!postData || !postData.address || postData.address == "") {
		// 	appUI.showTopTip("详细地址不能为空");
		// 	return;
		// }
		// 
		// if(isEmptyObject(postData)) {
		// 	appUI.showTopTip("提交数据不能为空");
		// 	return;
		// }
			postData.phone_no=document.getElementById("phone_no").value;
		  postData.weibo_id=document.getElementById("weibo").value;
		  postData.linkedin_id=document.getElementById("linkedin_id").value;
		  postData.yearly_income=document.getElementById("yearly_income").value==""?0:document.getElementById("yearly_income").value;
		  postData.yearly_expense=document.getElementById("yearly_expense").value==""?0:document.getElementById("yearly_expense").value;
		postData.address = document.getElementById("address").value
		postData.wechat_no=document.getElementById("wechat_no").value;
		if(postData2.src=="0"){
			postData.phone_nm=document.getElementById("phone_nm").value;
		}else if(postData2.wechat_memo=="" || postData2.wechat_memo==null){
			postData.wechat_nm=document.getElementById("phone_nm").value;
		}else {
			postData.wechat_memo=document.getElementById("phone_nm").value;
		}
		 // postData.ext_city=;
		 if(document.getElementById("region").innerText.trim()=="请选择"){
			 postData.wechat_city=null;
		 }else{
			 postData.wechat_city=document.getElementById("region").innerText;
		 }
		 postData.industry=document.getElementById("industry").value;
		 let houseObj=document.getElementById("gdzc_house");
		 let house_loan=document.getElementById("gdzc_house_loan");
		 let carObj=document.getElementById("gdzc_car");
		 let car_loan=document.getElementById("gdzc_car_loan");
		 if(houseObj.classList.contains("checked")){
			 postData.house=1;
		 }else{
			 postData.house=0;
		 }
		 if(house_loan.classList.contains("checked")){
		 	postData.house_loan=1;
		 }else{
			 postData.house_loan=0;
		 }
		 
		if(carObj.classList.contains("checked")){
		 		 postData.car=1;
		 }else{
			 postData.car=0;
		 }
		 	 if(car_loan.classList.contains("checked")){
		 		 postData.car_loan=1;
		 }else{
			 postData.car_loan=0;
		 }
		 postData.sales_id=storageUser.UId;
		 postData.cust_id=custId;
		 // this.classList.contains("checked")){
		log(JSON.stringify(postData));
		// alert(JSON.stringify(postData));

		//request("/cmdb/saveOrUpdate_LpMgntCustMst/", postData, function(json) {
		request("/cmdb/customerUpdateController/", postData, function(json) {
			if(json[SysConstants.ERROR_CODE_KEY] == SysConstants.ERROR_CODE_OBJECT.ERROR_CODE_SUCCESS) {
				// mui.toast("修改完成");
				// 
			 let programmePage =plus.webview.getWebviewById("customerDetail");;
				mui.fire(programmePage, 'shuaxin', {custName:document.getElementById("phone_nm").value});  
				// localStorage.removeItem('customerData');
				let customerPage =plus.webview.getWebviewById("customer/customer.html");
				mui.fire(customerPage, 'refreshDOM', {custId:custId,custName:document.getElementById("phone_nm").value});  
				// plus.nativeUI.closeWaiting();
				setTimeout(function(){
					plus.nativeUI.closeWaiting();
					mui.back();
				},300);

			} else {
				mui.toast(json[SysConstants.ERROR_MESSAGE_KEY]);
			}
		}, true);
	}
				
	
			function isEmptyObject(e) {
				var t;
				for(t in e)
					return !1;
				return !0
			}
			
			
			function getData(custId){
					storage.init();
				storageUser = kidstorageuser.getInstance();
				//requestJsonFile("../../data/customerdetail/baseinfo_edit.json", {custId:custId}, function(r) {
				request("/cmdb/queryByCustomerID/", {cust_id:custId,sales_id:storageUser.UId}, function(r) {
				//mui.get("../../data/customerdetail/baseinfo.json", {custId:custId}, function(r) {
					// log(JSON.stringify(r));
					

						
					if (r.DATASET.length==0)
						return false;
					// document.getElementById("title_name").innerText=r.DATASET[0].src=="0"?r.DATASET[0].phone_nm:(r.DATASET[0].wechat_memo=="" || r.DATASET[0].wechat_memo==null?r.DATASET[0].wechat_nm:r.DATASET[0].wechat_memo);
					var model = r.DATASET[0];
					render("#baseInfo_div", "baseInfo", {model:model});
					postData2 = model;
					appPage.imgInit();
					// alert(model.phone_no=="" && model.wechat_phone==undefined);
					
					document.getElementById("birth_date").addEventListener("click", function(){
						var dtPicker = new mui.DtPicker({
							type: 'date' ,
							beginDate: new Date(1950, 00, 01),//设置开始日期 
							endDate: new Date(2024,11,31)
						});
						dtPicker.show(function (selectItems) {
							var y = selectItems.y.text;  //获取选择的年
							var m = selectItems.m.text;  //获取选择的月
							var d = selectItems.d.text;  //获取选择的日
							var date = y + "-" + m + "-" + d;
							document.getElementById("birth_date").innerText = date; 
							postData.birth_date=y + "-" + m + "-" + d;
							console.log(JSON.stringify(postData));
						});
					});
					initPicker(model.zipcode);
					initCheckBox(model);
					bindCheckEvent();
					
				})
			}
			
			function bindCheckEvent(){
				//性别
				mui(".male_div").on("click",".check_sex",function(){
					mui(".check_sex").each(function(index,item){
						this.classList.remove("i_blue");
					});
					this.classList.add("i_blue");
					postData.sex = this.id.split("_")[1];
				});
				
				 //婚姻状体
				mui(".marriage_div").on("click",".check_marriage",function(){
					mui(".check_marriage").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.marriage = this.id.split("_")[1];
				});
				//子女
				mui(".child_div").on("click",".check_child",function(){
					mui(".check_child").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.child = this.id.split("_")[1];
				});
				//父母
				mui(".parent_div").on("click",".check_parent",function(){
					mui(".check_parent").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.parent = this.id.split("_")[1];
				});
				//固定资产
				mui(".gdzc_div").on("click",".check_gdzc",function(){
					var tp = this.id;
					if (this.classList.contains("checked")){
						this.classList.remove("checked");
					} else{
						this.classList.add("checked");
					}
					
				});
				//体检
				mui(".health_check_div").on("click",".check_health_check",function(){
					mui(".check_health_check").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.health_check = this.id.split("_")[2];
				});
				//抽烟
				mui(".smoke_div").on("click",".check_smoke",function(){
					mui(".check_smoke").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.smoke = this.id.split("_")[1];
				});
				//饮酒
				mui(".alcohol_div").on("click",".check_alcohol",function(){
					mui(".check_alcohol").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.alcohol = this.id.split("_")[1];
				});
				//病史
				mui(".sick_div").on("click",".check_sick",function(){
					mui(".check_sick").each(function(index,item){
						this.classList.remove("checked");
					});
					this.classList.add("checked");
					postData.sick = this.id.split("_")[1];
				});
			}
			
			function initCheckBox(model){
				//性别
				if(model.sex == 'M'){
					document.getElementById("sex_M").classList.add("i_blue");
				} else if(model.sex == 'F'){
					document.getElementById("sex_F").classList.add("i_blue");
				}
				
				//婚姻状体

				if(model.marriage != null && model.marriage!=""){
					document.getElementById("marriage_"+model.marriage).classList.add("checked");
				}
				//子女
				if(model.child != null  && model.child!=""){
					document.getElementById("child_"+model.child).classList.add("checked");
				}
				//父母
				if(model.parent != null && model.parent!=""){
					document.getElementById("parent_"+model.parent).classList.add("checked");
				}
				
				//固定资产
				if(model.house != null && model.house!="" && model.house!="0"){
					document.getElementById("gdzc_house").classList.add("checked");
				}
				if(model.house_loan != null && model.house_loan!="" && model.house_loan!="0"){
					document.getElementById("gdzc_house_loan").classList.add("checked");
				}
				if(model.car != null && model.car!="" && model.car!="0"){
					document.getElementById("gdzc_car").classList.add("checked");
				}
				if(model.car_loan != null && model.car_loan!="" && model.car_loan!="0"){
					document.getElementById("gdzc_car_loan").classList.add("checked");
				}
				
				//体检
				if(model.health_check != null && model.health_check!=""){
					document.getElementById("health_check_"+model.health_check).classList.add("checked");
				}
				//抽烟
				if(model.smoke != null && model.smoke!=""){
					document.getElementById("smoke_"+model.smoke).classList.add("checked");
				}
				//饮酒
				if(model.alcohol != null && model.alcohol!=""){
					document.getElementById("alcohol_"+model.alcohol).classList.add("checked");
				}
				//病史
				if(model.sick != null && model.sick!=""){
					document.getElementById("sick_"+model.sick).classList.add("checked");
				}
				
				if(model.wechat_city != null && model.wechat_city!="" && model.wechat_city!=undefined){
					document.getElementById("region").innerText=model.wechat_city;
				}
			
			}
		
			function initPicker(defaultVal){
				var regionobj = document.getElementById("region");
				
				regionPicker = new mui.PopPicker({
					layer: 3
				});
				
				regionPicker.setData(region);
				if(defaultVal!=null && defaultVal!=""){
					var vals = defaultVal.split("-");
					console.log(JSON.stringify(postData));
					regionPicker.pickers[0].setSelectedValue(vals[0]);
					regionPicker.pickers[1].setSelectedValue(vals[1]);
					regionPicker.pickers[2].setSelectedValue(vals[2]);
					// setTimeout("initSelectData()", 100);
				}
				
				regionobj.addEventListener("click", function() {
					regionPicker.show(function(items) {
						var op1 = (items[0] || {});
						var op2 = (items[1] || {});
						var op3 = (items[2] || {});
						if(op1.value==0){
							regionobj.innerText = (items[0] || {}).text;
						}else{
							regionobj.innerText = (items[0] || {}).text + " - " + (items[1] || {}).text + " - " + (items[2] || {}).text;
						}
						postData.zipcode = op1.value+"-"+op2.value+"-"+op3.value
						//返回 false 可以阻止选择框的关闭
						//return false;
					});
				});
			}
			
	
		
		</script>
	</body>
</html>
